package com.ym.domain.model;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.gitee.sunchenbin.mybatis.actable.annotation.ColumnComment;
import com.gitee.sunchenbin.mybatis.actable.annotation.Index;
import com.gitee.sunchenbin.mybatis.actable.annotation.IsKey;
import com.gitee.sunchenbin.mybatis.actable.annotation.TableComment;
import lombok.Data;

import javax.persistence.Column;
import javax.persistence.Table;
import java.time.LocalDateTime;

@Data
@Table
@TableComment("域名解析记录表")
public class DmDomainResolution {

    // 记录类型(dns_create_id : DNS添加域名的域名ID)
    public static final String TYPE_DNS_CREATE_ID = "dns_create_id";

    @IsKey
    @TableId(type = IdType.ASSIGN_ID)
    @Column
    @ColumnComment("主键ID")
    private Long id;

    /**
     * type	   记录类型	string	选填,默认为A记录
     * viewID  线路ID	int	    选填,默认为默认线路
     * host    主机头	string	选填,默认为@
     * value   记录值	string	所要添加的记录的记录值,如 127.0.0.1
     * TTL	   TTL	    int	    TTL
     * mx	   MX	    string	当type为MX时 值为MX记录优先值，其他为权重值（数值越大权重越高，范围1-55） 参考文章
     * remark  备注	    string	备注
     */

    @Index
    @Column
    @ColumnComment("域名ID")
    private Long domainId;

    @Column(length = 255)
    @ColumnComment("记录类型")
    private String type;

    @Column
    @ColumnComment("线路ID")
    private Integer viewId;

    @Column(length = 255)
    @ColumnComment("主机头")
    private String host;

    @Column(length = 255)
    @ColumnComment("记录值")
    private String value;

    @Column
    @ColumnComment("TTL")
    private Integer ttl;

    @Column(length = 255)
    @ColumnComment("MX")
    private String mx;

    @Column(length = 255)
    @ColumnComment("备注")
    private String remark;

    @Column
    @ColumnComment("解析记录ID")
    private Long recordId;

    @Column
    @TableField(fill = FieldFill.INSERT)
    @ColumnComment("创建时间")
    private LocalDateTime createTime;

}
